package com.ypf.survey.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.springframework.stereotype.Repository;

import com.ypf.survey.dao.AnswerDAO;
import com.ypf.survey.model.Answer;

@Repository
public class AnswerDAOImpl extends GenericDAOImpl<Answer, Long> implements AnswerDAO {

	protected AnswerDAOImpl() {
		super(Answer.class.getName());
	}

	@SuppressWarnings("unchecked")
	public List<Answer> getAllAnswers() {
		DetachedCriteria criteria = DetachedCriteria.forEntityName(entityName);
		criteria.addOrder(Order.asc("user"));
		return getHibernateTemplate().findByCriteria(criteria);
	}

}
